#include "rendermanager.h"

RenderManager::RenderManager() : mouseUtils(&Chunks, &Camera)
{
}

RenderManager *RenderManager::getInstance(){
    static RenderManager* inst=0;
    if(!inst)inst = new RenderManager();
    return inst;
}


void RenderManager::Render(){//optimize later to O(1) frustrum culling by sampling points
    int size=Chunks.Size();
    Camera.GetCurrentFrustrum();
    for(int i=0;i<size;i++)
        if( Camera.ChunkInFrustrum(Chunks[i]) && !Chunks[i].IsEmpty()){
            Chunks[i].render();
        }
}



